A. Field of the Invention
This invention relates to systems for limiting access to parts of shared software libraries and, more particularly, to systems for limiting access to object class definition files within shared libraries using class loaders.
B. Description of the Related Art
Software vendors typically ship their products as a set of shared libraries, such as libraries written in the Java™ object-oriented programming language and packaged as a conventional shared library file called a JAR file. In this manner, program files stored within these libraries can be easily and efficiently shared and used by any program module that is part of the vendor's product.
Shared libraries are often used to maintain class definitions when the vendor's product is written using object-oriented programming. In an object-oriented programming environment, an object generally encapsulates data members and function members (or methods) that manipulate the data member. An object is an instance of a class, which defines various data members and methods shared by objects of the same class. Thus, shared libraries can be used to define each type of object used in the vendor's product.
It is important that a user be able to access the parts of shared libraries that are meant to be shared. This is how its contents (generally referred to as program files) are meant to be used in such a library implementation. However, not all of the contents are meant to be used externally to the shared library. There are class definitions and objects that can be accessed by any code that uses the shared library, even though these class definitions and objects are meant to be only used internally in the library implementation. As a result, one of the problems faced by software vendors using shared libraries is limiting access to those parts of shared libraries that are not meant to be shared externally to the library implementation. For example, in a Java™ library packaged into a JAR file, a package is declared to be public and can then be accessed by any code that uses the Java™ library despite the fact that the Java™ package is meant to be only used internally to the library.
Aside from the basic problem of providing an external process with unauthorized access to these parts of the shared library, other problems may occur as a result of doing so. For example, namespace problems may occur when externally using parts of a shared library that are supposed to be only used internal to the library. The software vendor that created the shared library may use specific names or a naming convention for parts of the shared library without regard to namespace collisions external to the shared library. However, when an external process accesses a package meant to be strictly internal to the library, the name for the package may conflict with the name of another package or object already used by the external process. In such a situation, there may be a duplication of class definitions for a given package name leading to problems on how to resolve what functionality is associated with the named packages or objects.
The introduction of sealing in the Java™ programming language has improved the situation by allowing some instances of this problem to be detected and an error raised. However, simply raising an error at run-time and requiring the end user to take appropriate action to fix the problem is not as desirable as having the program work as intended. Also, sealing will not generally help in the important case of wanting to ship an application or applet bundled with a particular version of some extension. If some different version of that extension is already installed on an end user's computer, the installed one takes precedence over the bundled one.
Accordingly, there is a need for a system that permits access to certain parts of a shared library while limiting access to other parts of the shared library.